import Global from "../Global"
import cjs=createjs
import Pool from "../Pool"
//import createjs from "../../createjs"
export default class Bomb extends cjs.Container{
    private _bomb
    constructor(){
        super()
        this.name='bomb'
        const lib=Global.getLibrary()
        this._bomb=new lib.Bomb()
        this.addChild(this._bomb)
        console.log('new Bomb')
    }
    private addEvent():void{
        this._bomb.on('BombComplete',():void=>{
            const parent=this.parent;
            //console.log(this.parent);
            (parent as cjs.Container).removeChild(this);
            Pool.getInstance().recover('Bomb',this);
        },null,true)
    }
    /**
     * 重置
     */
    reset():void{
        this._bomb.gotoAndPlay(0)
        this.addEvent()
    }
    getBounds(): cjs.Rectangle {
        return this._bomb.getBounds()
    }
}